package cn.org.mrliu.ssm.qq;

import java.io.Serializable;

/**
 * QQ消息
 * 
 * @author MrLiu
 *
 */
public class QQMessage implements Serializable {
	private static final long serialVersionUID = -8601265076089727901L;
	private String sender = "admin";
	private String qq;
	private String message;
	private String type = QQMessageType.SEND_MESSAGE;
	private QQMessageCallback qqMessageCallback;

	public QQMessage() {
		super();
	}

	public QQMessage(String sender, String qq, String message) {
		super();
		this.sender = sender;
		this.qq = qq;
		this.message = message;
	}

	public QQMessage(String sender, String qq, String message, String type) {
		super();
		this.sender = sender;
		this.qq = qq;
		this.message = message;
		this.type = type;
	}

	public QQMessage(String sender, String qq, String message, String type, QQMessageCallback qqMessageCallback) {
		super();
		this.sender = sender;
		this.qq = qq;
		this.message = message;
		this.type = type;
		this.qqMessageCallback = qqMessageCallback;
	}

	public String getSender() {
		return sender;
	}

	public void setSender(String sender) {
		this.sender = sender;
	}

	public String getQq() {
		return qq;
	}

	public void setQq(String qq) {
		this.qq = qq;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public QQMessageCallback getQqMessageCallback() {
		return qqMessageCallback;
	}

	public void setQqMessageCallback(QQMessageCallback qqMessageCallback) {
		this.qqMessageCallback = qqMessageCallback;
	}

	/**
	 * 发送:将QQ消息添加到消息队列中
	 */
	public void send() {
		// 添加到消息队列中
		QQMessageQueue.getInstance().push(this);
	}

	@Override
	public String toString() {
		return "QQMessage [sender=" + sender + ", qq=" + qq + ", message=" + message + ", type=" + type
				+ ", qqMessageCallback=" + qqMessageCallback + "]";
	}

}
